#ifndef __SUPERPOSICION_H__
#define __SUPERPOSICION_H__

#include <sys/stat.h>
#include <ctype.h>
#include <string.h>
#include <math.h>
#include <stdio.h>

#include "Element.h"
#include "Square.h"
#include "Circle.h"
#include "Rectangle.h"
#include "Segment.h"
#include "Rectangle.h"
#include "Elipse.h"
#include "Triangle.h"

typedef struct resultadosuperposicion {
	int superposicion;
	int X;
	int Y;
	float distancia;
	char* idElem1;
    char* idElem2;
} OverlapResult;



//wrapper sobre shapes

OverlapResult s_elipseToCircle(Elipse* e1,Circle* c2);
OverlapResult s_elipseToRectangle(Elipse* e1,Rectangle* r2);
OverlapResult s_squareToSquare(Square* s1,Square* s2);
OverlapResult s_squareToCircle(Square* s1,Circle* c2);
OverlapResult s_squareToSegment(Square* s1,Segment* s2);
OverlapResult s_squareToRectangle(Square* s1,Rectangle* r2);
OverlapResult s_circleToRectangle(Circle* c1,Rectangle* r2);
OverlapResult s_segmentToRectangle(Segment* s1,Rectangle* r2);
OverlapResult s_rectangleToRectangle(Rectangle* r1,Rectangle* r2);
OverlapResult s_segmentToCircle(Segment* s1,Circle* c2);
OverlapResult s_circleToCircle(Circle* c1,Circle* c2);
OverlapResult s_segmentToSegment(Segment* s1,Segment* s2);
OverlapResult s_circleToTriangle(Circle* c1,Triangle* t2);
OverlapResult s_rectangleToTriangle(Rectangle* r1,Triangle* t2);


//wrapper sobre elements

OverlapResult squareToSquare(Element* s1,Element* s2);
OverlapResult squareToCircle(Element* s1,Element* c2);
OverlapResult squareToSegment(Element* s1,Element* s2);
OverlapResult squareToRectangle(Element* s1,Element* r2);
OverlapResult circleToRectangle(Element* c1,Element* r2);
OverlapResult segmentToRectangle(Element* s1,Element* r2);
OverlapResult rectangleToRectangle(Element* r1,Element* r2);
OverlapResult segmentToCircle(Element* s1,Element* c2);
OverlapResult circleToCircle(Element* c1,Element* c2);
OverlapResult segmentToSegment(Element* s1,Element* s2);



// estas funciones vendrian a ser como "privadas"

OverlapResult superposicionElipseCirculo(int x1, int y1, int rh, int rv,int x2, int y2, int r2);

OverlapResult superposicionElipseRectangulo(int x1, int y1, int rh, int rv, int x2, int y2, int h2, int w2);

OverlapResult superposicionSegmentos(int x1i, int y1i, int x1f, int y1f, int x2i, int y2i, int x2f, int y2f);

OverlapResult superposicionCuadrados(int x1, int y1, int h1, int w1, int x2, int y2, int h2, int w2);

OverlapResult superposicionCirculos(int x1, int y1, int r1, int x2, int y2, int r2);

OverlapResult superposicionCirculoCuadrado(int x1, int y1, int h1, int w1, int x2, int y2, int r2);

OverlapResult superposicionSegmentoCirculo(int x1i, int y1i, int x1f, int y1f, int x2, int y2, int r2);

OverlapResult superposicionSegmentoCuadrado (int x1i, int y1i, int x1f, int y1f, int x2, int y2, int h2, int w2);

OverlapResult superposicionCirculoTriangulo(int xC, int yC, int r, int x1, int y1, int x2, int y2,int x3, int y3);

OverlapResult superposicionCuadradoTriangulo (int xC, int yC, int w, int h,int x1, int y1, int x2, int y2, int x3, int y3);

float calcularDistanciaOrigen (int x1, int y1);

void mostrameCercano (int xMenor, int xMayor, int yMenor, int yMayor, float a, float b, int *xCercano, int* yCercano, float* distanciaXY);

#endif
